home *** CD-ROM | disk | FTP | other *** search
/ PC Player 2004 May / pc player 2004-05.iso / Demos / FarCry / Data1.cab / _1D1ED9AF8E8F488A8206D348BC0AA8A3 < prev    next >
Encoding:
Text File  |  2004-01-06  |  30.2 KB  |  993 lines

  1.  
  2. -- Bigtrack
  3. Bigtrack = {
  4. --    type = "Vehicle",
  5.  
  6.     IsCar = 1,
  7.  
  8.     IsPhisicalized = 0,
  9.  
  10.     --model to be used for destroyed vehicle
  11.     fileModelDead = "objects/Vehicles/hemtt/hemtt_wreck.cgf",
  12.     fileModelPieces = "objects/Vehicles/hemtt/hemtt_pieces.cgf",    
  13.     waterDepth = 1,    -- if water is deeper then this value - vehicle can't be used
  14.  
  15.     windows={
  16.         {
  17.         fileName="Objects/vehicles/hemtt/hemtt_window_left.cgf",
  18.         helperName="front_window_left",        --"window1",
  19.         entity=nil,
  20.         },
  21.         {
  22.         fileName="Objects/vehicles/hemtt/hemtt_window_right.cgf",
  23.         helperName="front_window_right",        --"window2",
  24.         entity=nil,
  25.         },
  26.     },
  27.  
  28.     IdleTime = 0,
  29.     FlipTime = 5,
  30.     FlipTimeTotal = .3,
  31.     FlipUpVel = 0,
  32.     FlipXVel = 0,
  33.     FlipYVel = 0,
  34.     FlipH = 5,
  35. --    FlipHCur = 0,
  36.     FlipIdle = 2,
  37.     FlipLimit = 65,
  38. --    FlipLimit = 6,    
  39.     FlipFlag = 0,
  40.  
  41.     userCounter = 0,
  42.     driverWaiting = 1,
  43.     driverDelay = 0,
  44.     
  45.     passengerLimit=9,
  46.  
  47.     -- if speed is over maximum - don't play exit animation
  48.     MaxSpeed2Exit = 7,
  49.  
  50.     driverId = 0,
  51.  
  52.     
  53.     driver = nil,
  54.  
  55.     -- previous state on the client before entering the vehicle
  56.     bDriverInTheVehicle = 0,
  57.     -- previous driver on the client before leaving the vehicle
  58.     pPreviousDriver=nil,
  59.     -- previous passenger state on the client before entering the vehicle
  60.     bPassengerInTheVehicle = 0,
  61.     -- previous passenger on the client before leaving the vehicle
  62.     pPreviousPassenger=nil,
  63.  
  64.     --third person view mode before player entered jeep
  65.     tpvStateD = 0,
  66.     tpvStateP = 0,
  67.     
  68.     turretResetMode = 0,
  69.     deltaZ = 0,
  70.     deltaX = 0,
  71.     curAngle = 0,
  72.     aSpeedZ = 300,
  73.     aSpeedX = 120,
  74.  
  75.     --used weapons
  76.     dWeapon = 0,
  77.     pWeapon = 0,
  78.     gWeapon = 0,
  79.     
  80.     CameraTargetPoint = nil,
  81.     
  82.     -- A temporary storage vector used converting local positions to world positions
  83. --    CurrentPosition = nil,
  84.  
  85. --    szNormalModel="Objects/Vehicles/HEMTT/hemtt_driveable.cgf",
  86.  
  87.     -- suspention
  88.     -- table used to store some data for suspension sound processing for each wheel
  89.     suspTable = {
  90.         {
  91.             helper = "wheel1_lower",
  92.             suspWheel = 0,            --    last frame suspension compretion ratio
  93.         },
  94.         {
  95.             helper = "wheel2_lower",
  96.             suspWheel = 0,            --    last frame suspension compretion ratio
  97.         },
  98.         {
  99.             helper = "wheel3_lower",
  100.             suspWheel = 0,            --    last frame suspension compretion ratio
  101.         },
  102.         {
  103.             helper = "wheel4_lower",
  104.             suspWheel = 0,            --    last frame suspension compretion ratio
  105.         },
  106.     },
  107.     suspSoundTable = {
  108.         nil,
  109.         nil,
  110.         nil,
  111.         nil,
  112.     },
  113.     -- suspension compresion threshold - when to start susp sound
  114.     suspThreshold = .02,
  115.     -- suspension over
  116.  
  117.     
  118.     CarDefDamage =     {
  119.       hull1 = { zoffset=-0.5    },
  120.         wheel1 = { driving=1,axle=0,len_max=0.7,stiffness=0,damping=-0.7, surface_id = 69, min_friction=1.8, max_friction=1.8 },
  121.         wheel2 = { driving=1,axle=0,len_max=0.7,stiffness=0,damping=-0.7, surface_id = 69, min_friction=1.8, max_friction=1.8 },
  122.         wheel3 = { driving=1,axle=1,len_max=0.7,stiffness=0,damping=-0.7, surface_id = 69, min_friction=1.8, max_friction=1.8 },
  123.         wheel4 = { driving=1,axle=1,len_max=0.7,stiffness=0,damping=-0.7, surface_id = 69, min_friction=1.8, max_friction=1.8 },        
  124.         wheel5 = { driving=1,axle=1,len_max=0.7,stiffness=0,damping=-0.7, surface_id = 69, min_friction=1.8, max_friction=1.8 },                
  125.         wheel6 = { driving=1,axle=1,len_max=0.7,stiffness=0,damping=-0.7, surface_id = 69, min_friction=1.8, max_friction=1.8 },        
  126.         wheel7 = { driving=1,axle=1,len_max=0.7,stiffness=0,damping=-0.7, surface_id = 69, min_friction=1.8, max_friction=1.8 },        
  127.         wheel8 = { driving=1,axle=1,len_max=0.7,stiffness=0,damping=-0.7, surface_id = 69, min_friction=1.8, max_friction=1.8 },        
  128.     },
  129.  
  130.     CarDefNormal =     {
  131.       hull1 = { zoffset=-0.5,yoffset=0.0    },
  132.         wheel1 = { driving=1,axle=0,len_max=0.3,stiffness=0,damping=-0.7, surface_id = 69, min_friction=1.0, max_friction=1.5 },
  133.         wheel2 = { driving=1,axle=0,len_max=0.3,stiffness=0,damping=-0.7, surface_id = 69, min_friction=1.0, max_friction=1.5 },
  134.         wheel3 = { driving=1,axle=1,len_max=0.3,stiffness=0,damping=-0.7, surface_id = 69, min_friction=1.0, max_friction=1.5 },
  135.         wheel4 = { driving=1,axle=1,len_max=0.3,stiffness=0,damping=-0.7, surface_id = 69, min_friction=1.0, max_friction=1.5 },        
  136.         wheel5 = { driving=1,axle=2,len_max=0.3,stiffness=0,damping=-0.7, surface_id = 69, min_friction=1.0, max_friction=1.5 },                
  137.         wheel6 = { driving=1,axle=2,len_max=0.3,stiffness=0,damping=-0.7, surface_id = 69, min_friction=1.0, max_friction=1.5 },        
  138.         wheel7 = { driving=1,axle=3,len_max=0.3,stiffness=0,damping=-0.7, surface_id = 69, min_friction=1.0, max_friction=1.5 },        
  139.         wheel8 = { driving=1,axle=3,len_max=0.3,stiffness=0,damping=-0.7, surface_id = 69, min_friction=1.0, max_friction=1.5 },        
  140.     },
  141.  
  142.  
  143.     CarDef = {        
  144.         file = "Objects/Vehicles/HEMTT/hemtt_driveable.cgf",
  145.         
  146.         engine_power =         1000000, -- default 110000
  147.         engine_power_back = 1000000, -- default 85000
  148.         engine_maxrpm = 2200, -- default 700
  149.         axle_friction = 7000, -- default 650
  150.         max_steer = 20, -- default 22
  151.         stabilizer = 0,
  152.         
  153.         max_braking_friction = 0.5,
  154.         handbraking_value = 9,-- meter/s / s
  155.         
  156.         max_braking_friction_nodriver = 1.0, --this friction is applied when there is no driver inside the car
  157.         handbraking_value_nodriver = 3,-- (meter/s / s) , same as above, this value is applied only when the car have no driver
  158.  
  159.         
  160.         engine_minRPM = 20,
  161.         engine_idleRPM = 80,
  162.         engine_startRPM = 400,
  163.         engine_shiftupRPM = 1500,
  164.         engine_shiftdownRPM = 700,
  165.         
  166.         clutch_speed = 2,
  167.         gears = { -7,0,6.7,5.1 },
  168.         
  169.         integration_type = 1,
  170.         brake_torque = 60000,
  171.             dyn_friction_ratio = 1.0,
  172.         gear_dir_switch_RPM = 20,
  173.         slip_threshold = 0.05,
  174.         
  175.         cam_stifness_positive = { x=400,y=400,z=100 },
  176.       cam_stifness_negative = { x=400,y=400,z=100 },
  177.       cam_limits_positive = { x=0,y=0.5,z=0 },
  178.       cam_limits_negative = { x=0,y=0.3,z=0 },
  179.       cam_damping = 22,
  180.       cam_max_timestep = 0.01,
  181.       cam_snap_dist = 0.001,
  182.       cam_snap_vel = 0.01,
  183.  
  184.         pedal_speed = 2.0,
  185.         steer_speed = 20.0, -- default 80
  186.         steer_speed_min = 10.0, -- default 260
  187.         steer_speed_valScale = 0.2, -- default 260        
  188.         max_steer_v0 = 25.0, -- default 22
  189.         max_steer_kv = 0.0,
  190.         steer_relaxation_v0 = 6.0,
  191.         steer_relaxation_kv = 6.0, -- default 40
  192.         
  193.         brake_vel_threshold = 2, -- default 1000 if vehicle's velocity is below this, normal handbrake is used, otherwise increased axle_friction is 
  194.       brake_axle_friction = 3000, -- used to simulate braking default 5000
  195.       
  196.       max_time_step_vehicle = 0.02,
  197.         sleep_speed_vehicle = 0.11,
  198.         damping_vehicle = 0.2,
  199.         
  200.         -- rigid_body_params
  201.         max_time_step = 0.01,
  202.         damping = 0.1,
  203.         sleep_speed = 0.04,
  204.         freefall_damping = 0.03,
  205.         gravityz = -10.81,
  206.         freefall_gravityz = -10.81,
  207.  
  208.         water_density=30,
  209.         
  210. --        hull0 = { mass=1859,flags=0,zoffset=.41    }, -- default mass 1859
  211.         hull1 = { mass=50000,flags=0,zoffset=-0.5,yoffset=0.0    }, -- default mass 2359
  212.         hull2 = { mass=0,flags=1    },
  213.         hull3 = { mass=0,flags=1    },
  214.         wheel1 = { driving=1,axle=0,len_max=0.7,stiffness=0,damping=-0.7, surface_id = 69, min_friction=1.8, max_friction=1.8 },
  215.         wheel2 = { driving=1,axle=0,len_max=0.7,stiffness=0,damping=-0.7, surface_id = 69, min_friction=1.8, max_friction=1.8 },
  216.         wheel3 = { driving=1,axle=1,len_max=0.7,stiffness=0,damping=-0.7, surface_id = 69, min_friction=1.8, max_friction=1.8 },
  217.         wheel4 = { driving=1,axle=1,len_max=0.7,stiffness=0,damping=-0.7, surface_id = 69, min_friction=1.8, max_friction=1.8 },
  218.         wheel5 = { driving=1,axle=1,len_max=0.7,stiffness=0,damping=-0.7, surface_id = 69, min_friction=1.8, max_friction=1.8 },
  219.         wheel6 = { driving=1,axle=1,len_max=0.7,stiffness=0,damping=-0.7, surface_id = 69, min_friction=1.8, max_friction=1.8 },
  220.         wheel7 = { driving=1,axle=1,len_max=0.7,stiffness=0,damping=-0.7, surface_id = 69, min_friction=1.8, max_friction=1.8 },
  221.         wheel8 = { driving=1,axle=1,len_max=0.7,stiffness=0,damping=-0.7, surface_id = 69, min_friction=1.8, max_friction=1.8 },
  222.         
  223.     },
  224.  
  225.     tmp = 0,
  226.  
  227.  
  228. --/////////////////////////////////////////////////////////////////////////
  229. -- damage stuff
  230.     -- particle system to display when the vehicle is damaged stage 1
  231.     Damage1Effect = "smoke.vehicle_damage1.a",
  232.     -- particle system to display when the vehicle is damaged stage 2
  233.     Damage2Effect = "smoke.vehicle_damage2.a",
  234.     -- particle system to display when the vehicle explodes
  235.     ExplosionEffect = "explosions.humvee_explosion.a",
  236.     -- particle system to display when the vehicle is destroyed
  237.     DeadEffect = "fire.burning_after_explosion.a",
  238.  
  239.  
  240.     bExploded=false,
  241.  
  242.     
  243. --    last frame suspension compretion ratio
  244.     suspWheel1 = 0,
  245.     suspWheel2 = 0,
  246.     suspWheel3 = 0,
  247.     suspWheel4 = 0,
  248.  
  249. --    delaytimer = 0,
  250. --    counting = nil,
  251.     part_time = 0,
  252.     partDmg_time = 0,
  253.     slip_speed = 0,
  254.     particles_updatefreq = 0.1,--0.05, --initial frequency of updating wheel dust particles and 1st damage partcls
  255.  
  256.     PropertiesInstance = {
  257.         sightrange = 180,
  258.         soundrange = 10,    -- rememeber that sound ranges intersect and sound range for AI doubles when in alert
  259.         aibehavior_behaviour = "Car_idle",        
  260.         groupid = 154,
  261.     },
  262.  
  263.     Properties = {        
  264.  
  265.         bActive = 1,    -- if vehicle is initially active or needs to be activated 
  266.                 -- with Event_Activate first
  267.         bLightsOn = 0,    
  268.     
  269.         object_Model="Objects/Vehicles/HEMTT/hemtt_driveable.cgf",    
  270.     
  271.         bTrackable=1,
  272.         bDrawDriver = 0,
  273.         fLimitLRAngles = 100,
  274.         fLimitUDMinAngles = -30,
  275.         fLimitUDMaxAngles = 20,
  276.  
  277.         -- [kirill] vehicle gets different damage depending on who's shooter
  278.         -- defines the intensity of the damage caused by the weapons to
  279.         -- the vehicle
  280.         -- shooter is player
  281.         fDmgScaleExplosion = 0.07,        -- explosions
  282.         fDmgScaleBullet = 0.03,            -- shooting
  283.         -- shooter is AI
  284.         fDmgScaleAIExplosion = 0.03,        -- explosions
  285.         fDmgScaleAIBullet = 0.02,            -- shooting
  286.         
  287.         ExplosionParams = {
  288.             nDamage = 600,
  289.             fRadiusMin = 8.0, -- default 12
  290.             fRadiusMax = 10, -- default 35.5
  291.             fRadius = 10, -- default 17
  292.             fImpulsivePressure = 200, -- default 200
  293.             },
  294.             
  295.         bUsable = 1,                                -- if this vehicle can be used by _localplayer
  296.  
  297. -- those are AI related properties
  298.         pointReinforce = "Drop",
  299.         pointBackOff = "Base",
  300.         aggression = 1.0,
  301.         commrange = 100.0,
  302.         cohesion = 5,
  303.         attackrange = 70,
  304.         horizontal_fov = 160,
  305.         vertical_fov =90,
  306.         eye_height = 2.1,
  307.         max_health = 70,
  308.         responsiveness = 7,
  309.         species = 1,
  310.         fSpeciesHostility = 2,
  311.         fGroupHostility = 0,
  312.         fPersistence = 0,
  313.         aicharacter_character = "CarHumvee",
  314.         bApproachPlayer = 1,
  315.         bodypos = 0,
  316.         pathname = "drive",
  317.         pathsteps = 0,
  318.         pathstart = 0,
  319.         bPathloop = 1,
  320.         ReinforcePoint = "none",            
  321.         fApproachDist = 20,
  322.         
  323.         bUsePathfind = 1,    -- pathfind when outdoors        
  324.         
  325.         hit_upward_vel = 6,
  326.         damage_players = 1,
  327.         forward_speed = 1,    
  328.     },
  329.  
  330.     -- engine health, status of the vehicle
  331.     -- default is set to maximum (1.0f)
  332.     fEngineHealth = 100.0,
  333.  
  334.     -- damage inflicted to the vehicle when it collides
  335.     fOnCollideDamage=0,
  336.     -- damage inflicted to the vehicle when it collides with terrain (falls off)
  337.     fOnCollideGroundDamage=0.3,
  338.     
  339.     --damage inflicted when falling , this value is multiplied by the half of the square of the falling speed:
  340.     --for istance: 5 m/s = 12 dmgpoints * fOnFallDamage
  341.     --          10 m/s = 50 dmgpoints * fOnFallDamage
  342.     --          20 m/s = 200 dmgpoints * fOnFallDamage
  343.     fOnFallDamage=0.05,
  344.     
  345.  
  346.  
  347.     bGroundVehicle=1,
  348.  
  349.     driverT = {
  350.         type = PVS_DRIVER,
  351.     
  352.         helper = "driver",    -- to bind to
  353.         in_helper = "driver_sit_pos",
  354.         in_anim = "hemtt_driver_in",
  355.         out_anim = "hemtt_driver_out",
  356.         sit_anim = "hemtt_driver_sit",
  357.         anchor = AIAnchor.z_CARENTER_DRIVER,
  358.         out_ang = -90,
  359.         message = "@driverbigtruck",
  360.     },
  361.     
  362.     passengersTT = {
  363.         {
  364.             type = PVS_PASSENGER,
  365.         
  366.             helper = "passenger2",
  367.             in_helper = "passenger2_sit_pos",
  368.             in_anim = "hemtt_passenger_front_in",
  369.             out_anim = "hemtt_passenger_front_out",
  370.             sit_anim = "hemtt_passenger_front_sit",
  371.             anchor = AIAnchor.z_CARENTER_PASSENGER2,
  372.             out_ang = -90,
  373.             message = "@passengerbigtruck",
  374.         },
  375.         {
  376.             type = PVS_PASSENGER,
  377.         
  378.             helper = "passenger3",
  379.             in_helper = "passenger3_sit_pos",
  380.             in_anim = "hemtt_passenger_r_in",
  381.             out_anim = "hemtt_passenger_r_out",
  382.             sit_anim = "hemtt_passenger_r_sit",
  383.             anchor = AIAnchor.z_CARENTER_PASSENGER3,
  384.             out_ang = 90,
  385.             message = "@passengerbigtruck",
  386.         },
  387.         {
  388.             type =PVS_PASSENGER,        
  389.                 
  390.             helper = "passenger4",
  391.             in_helper = "passenger4_sit_pos",
  392.             in_anim = "hemtt_passenger_r_in",
  393.             out_anim = "hemtt_passenger_r_out",
  394.             sit_anim = "hemtt_passenger_r_sit",
  395.             anchor = AIAnchor.z_CARENTER_PASSENGER4,
  396.             out_ang = -90,
  397.             message = "@passengerbigtruck",
  398.         },
  399.         {
  400.             type = PVS_PASSENGER,
  401.                     
  402.             helper = "passenger5",
  403.             in_helper = "passenger5_sit_pos",
  404.             in_anim = "hemtt_passenger_r_in",
  405.             out_anim = "hemtt_passenger_r_out",
  406.             sit_anim = "hemtt_passenger_r_sit",
  407.             anchor = AIAnchor.z_CARENTER_PASSENGER5,
  408.             out_ang = 90,
  409.             message = "@passengerbigtruck",
  410.         },
  411.         {
  412.             type = PVS_PASSENGER,
  413.                     
  414.             helper = "passenger6",
  415.             in_helper = "passenger6_sit_pos",
  416.             in_anim = "hemtt_passenger_r_in",
  417.             out_anim = "hemtt_passenger_r_out",
  418.             sit_anim = "hemtt_passenger_r_sit",
  419.             anchor = AIAnchor.z_CARENTER_PASSENGER6,
  420.             out_ang = 90,
  421.             message = "@passengerbigtruck",
  422.         },
  423.         {
  424.             type = PVS_PASSENGER,
  425.                     
  426.             helper = "passenger7",
  427.             in_helper = "passenger7_sit_pos",
  428.             in_anim = "hemtt_passenger_l_in",
  429.             out_anim = "hemtt_passenger_l_out",
  430.             sit_anim = "hemtt_passenger_l_sit",
  431.             anchor = AIAnchor.z_CARENTER_PASSENGER7,
  432.             out_ang = 90,
  433.             message = "@passengerbigtruck",
  434.         },
  435.         {
  436.             type = PVS_PASSENGER,
  437.                     
  438.             helper = "passenger8",
  439.             in_helper = "passenger8_sit_pos",
  440.             in_anim = "hemtt_passenger_l_in",
  441.             out_anim = "hemtt_passenger_l_out",
  442.             sit_anim = "hemtt_passenger_l_sit",
  443.             anchor = AIAnchor.z_CARENTER_PASSENGER8,
  444.             out_ang = 90,
  445.             message = "@passengerbigtruck",
  446.         },
  447.         {
  448.             type = PVS_PASSENGER,
  449.                     
  450.             helper = "passenger9",
  451.             in_helper = "passenger9_sit_pos",
  452.             in_anim = "hemtt_passenger_l_in",
  453.             out_anim = "hemtt_passenger_l_out",
  454.             sit_anim = "hemtt_passenger_l_sit",
  455.             anchor = AIAnchor.z_CARENTER_PASSENGER9,
  456.             out_ang = 90,
  457.             message = "@passengerbigtruck",
  458.         },
  459.         {
  460.             type = PVS_PASSENGER,
  461.                     
  462.             helper = "passenger10",
  463.             in_helper = "passenger10_sit_pos",
  464.             in_anim = "hemtt_passenger_l_in",
  465.             out_anim = "hemtt_passenger_l_out",
  466.             sit_anim = "hemtt_passenger_l_sit",
  467.             anchor = AIAnchor.z_CARENTER_PASSENGER10,
  468.             out_ang = 90,
  469.             message = "@passengerbigtruck",
  470.         },
  471.     },
  472.     
  473. }
  474.  
  475. VC.CreateVehicle(Bigtrack);
  476.  
  477. --////////////////////////////////////////////////////////////////////////////////////////
  478. function Bigtrack:OnReset()
  479.  
  480.     if(self.bExploded == 1) then
  481.         VC.InitGroundVehicleServer(self,self.Properties.object_Model);
  482.     end    
  483.  
  484.     VC.OnResetCommon(self);
  485.     self:NetPresent(1);
  486.     VC.EveryoneOutForce(self);
  487.     self.fEngineHealth = 100.0;
  488.     self.bExploded=false;
  489.     self.cnt:SetVehicleEngineHealth(self.fEngineHealth);
  490.     
  491.     AI:RegisterWithAI(self.id, AIOBJECT_CAR,self.Properties,self.PropertiesInstance);
  492.     VC.InitAnchors( self );    
  493.     VC.AIDriver( self, 0 );    
  494.  
  495.     self.step = self.Properties.pathstart - 1;
  496.  
  497.     VC.InitWindows(self);
  498.     
  499. end
  500.  
  501.  
  502. --////////////////////////////////////////////////////////////////////////////////////////
  503. function Bigtrack:InitPhis()
  504.  
  505.     VC.InitGroundVehiclePhysics(self,self.Properties.object_Model);
  506. end    
  507.  
  508. --////////////////////////////////////////////////////////////////////////////////////////
  509. function Bigtrack:InitClient()
  510.     VC.InitSeats(self, Bigtrack);
  511.  
  512.     --/////////////////////////////////////////////////////////////////////////
  513.     -- local sounds for the client
  514.  
  515. --    self.drive_sound = Sound:Load3DSound("sounds\\vehicle\\buggy\\aidle_loop.wav",0,200,7,100000);
  516.     self.drive_sound_move = Sound:Load3DSound("sounds\\vehicle\\tire_rocks.wav",0,200,7,100000);
  517. --    self.accelerate_sound = {
  518. --        Sound:Load3DSound("sounds\\vehicle\\rev.wav",0,0,7,100000),
  519. --        Sound:Load3DSound("sounds\\vehicle\\rev.wav",0,0,7,100000),
  520. --        Sound:Load3DSound("sounds\\vehicle\\rev.wav",0,0,7,100000),
  521. --        Sound:Load3DSound("sounds\\vehicle\\rev.wav",0,0,7,100000),
  522. --    };
  523.  
  524.     self.suspSoundTable[1] = Sound:Load3DSound("sounds\\vehicle\\comp1.wav",0,150,7,100000);
  525.     self.suspSoundTable[2] = Sound:Load3DSound("sounds\\vehicle\\comp2.wav",0,150,7,100000);    
  526.     self.suspSoundTable[3] = Sound:Load3DSound("sounds\\vehicle\\comp3.wav",0,150,7,100000);    
  527.     self.suspSoundTable[4] = Sound:Load3DSound("sounds\\vehicle\\comp4.wav",0,150,7,100000);    
  528.  
  529.     self.break_sound = Sound:Load3DSound("sounds\\vehicle\\break1.wav",0,100,7,100000);
  530.     self.engine_start = Sound:Load3DSound("sounds\\vehicle\\buggy\\abuggy_start.wav",0,200,7,100000);
  531.     self.engine_off = Sound:Load3DSound("sounds\\vehicle\\buggy\\abuggy_off.wav",0,120,7,100000);
  532.     self.sliding_sound = Sound:Load3DSound("sounds\\vehicle\\break2.wav",0,150,7,100000);
  533.  
  534.     -------------------------------------------------------------------------------------
  535. --    self.gearup_sounds= {    
  536. --        Sound:Load3DSound("sounds\\vehicle\\HV\\hvlowspeedgeardown.wav",0,255,7,50), -- reverse up (0-1)        
  537. --        Sound:Load3DSound("sounds\\vehicle\\HV\\hvfirstaccel.wav",0,255,7,50), -- (1-2)
  538. --        Sound:Load3DSound("sounds\\vehicle\\HV\\hvsecondaccel.wav",0,255,7,50), -- (2-3)
  539. --        Sound:Load3DSound("sounds\\vehicle\\HV\\hvsecondaccel.wav",0,255,7,50), -- (3-4)
  540. --        Sound:Load3DSound("sounds\\vehicle\\HV\\hvsecondaccel.wav",0,255,7,50), -- (4-5)
  541. --    };
  542. --
  543. --    self.geardn_sounds={        
  544. --        Sound:Load3DSound("sounds\\vehicle\\HV\\hvfirstaccel.wav",0,255,7,50), -- reverse down (1-0)
  545. --        Sound:Load3DSound("sounds\\vehicle\\HV\\hvlowspeedgeardown.wav",0,255,7,50), -- (2-1)
  546. --        Sound:Load3DSound("sounds\\vehicle\\HV\\hvhighgeardown.wav",0,255,7,50), -- (3-2)
  547. --        Sound:Load3DSound("sounds\\vehicle\\HV\\hvhighgeardown.wav",0,255,7,50), -- (4-3)
  548. --        Sound:Load3DSound("sounds\\vehicle\\HV\\hvhighgeardown.wav",0,255,7,50), -- (5-4)
  549. --    };
  550. --
  551. --    self.idle_sounds={                
  552. --        Sound:Load3DSound("sounds\\vehicle\\HV\\hvidle.wav",0,255,7,50), -- reverse idle (0)
  553. --        Sound:Load3DSound("sounds\\vehicle\\HV\\hvidle.wav",0,255,7,50), -- engine idle (1)
  554. --        Sound:Load3DSound("SOUNDS\\Vehicle\\HV\\hvfirstgearspeedidle.wav",0,255,7,50), -- (2)
  555. --        Sound:Load3DSound("SOUNDS\\Vehicle\\HV\\hvsecondgearspeedidle.wav",0,255,7,50), -- (3)
  556. --        Sound:Load3DSound("SOUNDS\\Vehicle\\HV\\hvtopspeedidle.wav",0,255,7,50), -- (4)                
  557. --        Sound:Load3DSound("SOUNDS\\Vehicle\\HV\\hvtopspeedidle.wav",0,255,7,50), -- (5)    
  558. --    };
  559.     
  560.     self.clutch_sound = Sound:Load3DSound("sounds\\vehicle\\vehicle_efx\\gearchange.wav",0,100,7,200);
  561.     
  562.     self.idleengine = Sound:Load3DSound("sounds\\vehicle\\HV\\hvfirstgearspeedidle.wav",0,255,7,200);
  563.     self.idleengine_ratios = {0.9,0.9,1.15,0.9};
  564.     self.clutchengine_frequencies = {1000,1000,500,700};
  565.     self.clutchfreqspeed = 10;
  566.     self.enginefreqspeed = 1;
  567.  
  568.     --self.nogroundcontact_sound=Sound:Load3DSound("sounds\\vehicle\\HV\\hvfirstaccel.wav",0,255,7,50);
  569.     self.land_sound = Sound:Load3DSound("sounds\\vehicle\\vehicle_efx\\carclunk.wav",0,255,7,100);
  570.     -------------------------------------------------------------------------------------
  571.  
  572.     self.compression_sound1 = Sound:Load3DSound("sounds\\vehicle\\comp1.wav",0,0,7,100000);
  573.     self.compression_sound2 = Sound:Load3DSound("sounds\\vehicle\\comp2.wav",0,0,7,100000);
  574.     self.compression_sound3 = Sound:Load3DSound("sounds\\vehicle\\comp3.wav",0,0,7,100000);
  575.     self.compression_sound4 = Sound:Load3DSound("sounds\\vehicle\\comp4.wav",0,0,7,100000);
  576.     self.ExplosionSound=Sound:Load3DSound("sounds\\explosions\\explosion2.wav",0,255,150,1000);
  577.  
  578. --    self.buggy_sound = Sound:Load3DSound("sounds\\vehicle\\buggy.wav",0,200,7,100000);
  579.  
  580.     self.crash_sound = Sound:Load3DSound("sounds\\vehicle\\carcrash.wav",0,200,7,100000);
  581.  
  582.     VC.InitGroundVehicleClient(self, self.Properties.object_Model);
  583.     
  584.     self.cnt:InitLights( "front_light","textures/lights/front_light",
  585.             "front_light_left","front_light_right","humvee_frontlight",
  586.             "back_light_left", "back_light_right","humvee_backlight" );
  587.     
  588. end
  589.  
  590. --////////////////////////////////////////////////////////////////////////////////////////
  591. function Bigtrack:InitServer()
  592.     VC.InitSeats(self, Bigtrack);
  593.  
  594.     VC.InitGroundVehicleServer(self, self.Properties.object_Model);
  595.  
  596.     self:OnReset();
  597. end
  598.  
  599. --////////////////////////////////////////////////////////////////////////////////////////
  600. function Bigtrack:OnContactServer( player )
  601.  
  602.     if( self.Properties.bUsable==0 ) then return end
  603.     if( VC.IsUnderWater( self ) == 1 ) then return end
  604.     
  605.     VC.OnContactServerT(self,player);
  606. end
  607.  
  608. --////////////////////////////////////////////////////////////////////////////////////////
  609. function Bigtrack:OnContactClient( player )
  610.  
  611.     if( self.Properties.bUsable==0 ) then return end
  612.     if( VC.IsUnderWater( self ) == 1 ) then return end
  613.     
  614.     VC.OnContactClientT(self,player);
  615. end
  616.  
  617.  
  618.  
  619. -------------------------------------------------------------------------------------------------------------
  620. --
  621. --
  622. function Bigtrack:UpdateServer(dt)
  623.  
  624.     --filippo
  625.     --VC.FunPhysics(self,dt);
  626.     
  627.     VC.UpdateEnteringLeaving( self, dt );
  628.     VC.UpdateServerCommonT(self,dt);
  629.     
  630.     VC.UpdateWheelFriction( self );
  631.     
  632.     if( VC.IsUnderWater( self, dt ) == 1 ) then 
  633.         VC.EveryoneOutForce( self );
  634.     end;
  635.  
  636. end
  637.  
  638.  
  639. ----------------------------------------------------------------------------------------------------------------------------
  640. --
  641. --
  642. function Bigtrack:OnShutDown()
  643.  
  644.     --assingning to nil is not really needed
  645.     --if the entity will be destroyed
  646.     VC.EveryoneOutForce( self );    
  647.     self.break_sound=nil;
  648.     self.engine_start=nil;
  649.     self.engine_off=nil;
  650.     self.sliding_sound=nil;
  651.     self.drive_sound=nil;
  652.     self.drive_sound_move=nil;    
  653.     self.accelerate_sound=nil;
  654.  
  655.     VC.RemoveWindows(self); 
  656.     VC.RemovePieces(self);    
  657. end
  658.  
  659. ----------------------------------------------------------------------------------------------------------------------------
  660. --
  661. --
  662. function Bigtrack:OnSave(stm)
  663. end
  664.  
  665. ----------------------------------------------------------------------------------------------------------------------------
  666. --
  667. --
  668. function Bigtrack:OnLoad(stm)
  669. end
  670.  
  671. ----------------------------------------------------------------------------------------------------------------------------
  672. --
  673. --
  674. function Bigtrack:OnEventServer( id, params)
  675.  
  676.  
  677. --    if (id == ScriptEvent_Reset)
  678. --    then
  679. --        VC.EveryoneOutForce( self );    
  680. --    end
  681. end
  682.  
  683.  
  684. ----------------------------------------------------------------------------------------------------------------------------
  685. --
  686. --
  687.  
  688. ----------------------------------------------------------------------------------------------------------------------------
  689. --
  690. --
  691.  
  692. function Bigtrack:OnWrite( stm )
  693.     
  694.     
  695.     if(self.driver) then
  696.         stm:WriteInt(self.driver.id);
  697.     else    
  698.         stm:WriteInt(0);
  699.     end    
  700. end
  701.  
  702. ----------------------------------------------------------------------------------------------------------------------------
  703. --
  704. --
  705. function Bigtrack:OnRead( stm )
  706. local    id=0;    
  707.  
  708.  
  709.     id = stm:ReadInt();
  710.     if( id ~= 0 ) then
  711.         self.driver = System:GetEntity(id);
  712.     else
  713. --        self.driverP = self.driver;
  714.         self.driver = nil;
  715.     end
  716.     
  717. end
  718.  
  719. ----------------------------------------------------------------------------------------------------------------------------
  720. --
  721. --
  722.  
  723.  
  724. --////////////////////////////////////////////////////////////////////////////////////////
  725. --////////////////////////////////////////////////////////////////////////////////////////
  726. --// CLIENT functions definitions
  727. --////////////////////////////////////////////////////////////////////////////////////////
  728. --////////////////////////////////////////////////////////////////////////////////////////
  729.  
  730. Bigtrack.Client = {
  731.     OnInit = function(self)
  732.         self:InitClient();
  733.     end,
  734.     OnShutDown = function(self)
  735.         self:OnShutDown();
  736.     end,
  737.  
  738.     Alive = {
  739.         OnBeginState = function( self )    
  740.             VC.InitGroundVehicleCommon(self,self.szNormalModel);
  741.         end,
  742.         OnContact = function(self,player)
  743.              self:OnContactClient(player);
  744.         end,
  745.         OnUpdate = VC.UpdateClientAlive,
  746.         OnCollide = VC.OnCollideClient,
  747.         OnBind = VC.OnBind,
  748.         OnUnBind = VC.OnUnBind,
  749.     },
  750.     Inactive = {
  751.         OnBeginState = function( self )
  752.             self:Hide(1);
  753.         end,
  754.         OnEndState = function( self )
  755.             self.IsPhisicalized = 0;
  756.         end,
  757.     },    
  758.     Dead = {
  759.         OnBeginState = function( self )
  760.             VC.BlowUpClient(self);
  761.         end,
  762.         OnContact = function(self,player)
  763.              VC.OnContactClientDead(self,player);
  764.         end,
  765.         OnUpdate = VC.UpdateClientDead,
  766.         OnCollide = VC.OnCollideClient,
  767.         OnUnBind = VC.OnUnBind,
  768.     },
  769. }
  770.  
  771.  
  772. --////////////////////////////////////////////////////////////////////////////////////////
  773. --////////////////////////////////////////////////////////////////////////////////////////
  774. --// SERVER functions definitions
  775. --////////////////////////////////////////////////////////////////////////////////////////
  776. --////////////////////////////////////////////////////////////////////////////////////////
  777.  
  778. Bigtrack.Server = {
  779.     OnInit = function(self)
  780.         self:InitServer();
  781.     end,
  782.     OnShutDown = function(self)
  783.         self:OnShutDown();
  784.     end,
  785.     Alive = {
  786.         OnBeginState = function( self )    
  787.             VC.InitGroundVehicleCommon(self,self.szNormalModel);
  788.         end,
  789.         OnContact = function(self,player)
  790.              self:OnContactServer(player);
  791.         end,
  792.         OnDamage = VC.OnDamageServer,
  793.         OnCollide = VC.OnCollideServer,
  794.         OnUpdate = function(self,dt)
  795.             self:UpdateServer(dt);
  796.         end,
  797.         OnEvent = function (self, id, params)
  798.             self:OnEventServer( id, params);
  799.         end,
  800.     },
  801.     Inactive = {
  802.     },
  803.     Dead = {
  804.         OnBeginState = function( self )
  805.             VC.BlowUpServer(self);
  806.         end,
  807.     },
  808. }
  809.  
  810.  
  811. -------------------------------------------------------------------------------------------------------------
  812. --
  813. --
  814.  
  815. -------------------------------------------------------------------------------------------------------------
  816. --
  817. --
  818. function Bigtrack:DoEnter( puppet )
  819.  
  820.     if( puppet == self.driverT.entity ) then        
  821.         
  822. --System:Log("DoEnter     DRIVER");        
  823. --        local puppet = self.driver;        
  824.         self.driver = nil;
  825.         VC.AddUserT( self, self.driverT );
  826.         VC.InitEntering( self, self.driverT );
  827.     else
  828.         local tbl = VC.FindPassenger( self, puppet );
  829.         if( not tbl ) then return end
  830. --System:Log("DoEnter     passenger");
  831.         VC.AddUserT( self, tbl );
  832.         VC.InitEntering( self, tbl );
  833.     end
  834. end
  835.  
  836. -------------------------------------------------------------------------------------------------------------
  837. --
  838. --
  839. function Bigtrack:AddDriver( puppet )
  840.  
  841. --do return 0 end
  842.     if (self.driverT.entity ~= nil)        then    -- already have a driver
  843.         do return 0 end
  844.     end
  845.  
  846.     self.driver = puppet;
  847.     self.driverT.entity = puppet;
  848.     if( VC.InitApproach( self, self.driverT )==0 ) then    
  849.         self.DoEnter( puppet );
  850.     end    
  851.     do return 1 end    
  852. end
  853.  
  854. -------------------------------------------------------------------------------------------------------------
  855. --
  856. --
  857. function Bigtrack:AddGunner( puppet )
  858.     return 0;
  859. end
  860.  
  861. ----------------------------------------------------------------------------------------------------------------------------
  862. --
  863. --
  864. function Bigtrack:AddPassenger( puppet )
  865.  
  866.     local pasTbl = VC.CanAddPassenger( self, 1 );
  867.  
  868.     if( not pasTbl ) then    return 0 end    -- no more passangers can be added
  869.     
  870.     pasTbl.entity = puppet;
  871.     if( VC.InitApproach( self, pasTbl )==0 ) then
  872.         self.DoEnter( puppet );
  873.     end
  874.     do return 1 end    
  875. end
  876.  
  877. ----------------------------------------------------------------------------------------------------------------------------
  878. --
  879. --
  880. function Bigtrack:LoadPeople()
  881.  
  882.     if(VC.FreeToUse( self )==0) then return end    -- can't use it - player is in
  883.  
  884.     if(self.driverT.entity and self.driverT.entity.ai) then
  885.         AI:Signal(0, 1, "DRIVER_IN", self.id);
  886.     end    
  887.     
  888.     AI:Signal(SIGNALFILTER_GROUPONLY, 1, "wakeup", self.id);
  889.     AI:Signal(SIGNALFILTER_GROUPONLY, 1, "SHARED_ENTER_ME_VEHICLE", self.id);
  890.     self.dropState = 1;
  891.  
  892. end
  893.  
  894.  
  895. ----------------------------------------------------------------------------------------------------------------------------
  896. --
  897. --    to test-call reinf
  898. function Bigtrack:Event_Reinforcment( params )
  899.  
  900. --printf( "signaling BRING_REINFORCMENT " );    
  901.  
  902.     VC.AIDriver( self, 1 );    
  903.  
  904.     AI:Signal(0, 1, "BRING_REINFORCMENT", self.id);
  905.     
  906. end    
  907.  
  908.  
  909. ----------------------------------------------------------------------------------------------------------------------------
  910. --
  911. function Bigtrack:Event_GoPath( params )
  912.  
  913. --System:Log("\001  Humvee GoPath  ");
  914.  
  915.     VC.AIDriver( self, 1 );    
  916.  
  917.     AI:Signal(0, 1, "GO_PATH", self.id);
  918.  
  919. end
  920.  
  921. ----------------------------------------------------------------------------------------------------------------------------
  922. --
  923. function Bigtrack:Event_GoPatrol( params )
  924.  
  925. --System:Log("\001  Humvee GoPath  ");
  926.  
  927.     VC.AIDriver( self, 1 );    
  928.  
  929.     AI:Signal(0, 1, "GO_PATROL", self.id);
  930.  
  931. end
  932.  
  933.  
  934. ----------------------------------------------------------------------------------------------------------------------------
  935. --
  936. function Bigtrack:Event_GoChase( params )
  937.  
  938. --System:Log("\001  Humvee GoPath  ");
  939.  
  940.     AI:Signal(0, 1, "GO_CHASE", self.id);
  941.  
  942. end
  943.  
  944. ----------------------------------------------------------------------------------------------------------------------------
  945. --
  946. -- 
  947. function Bigtrack:Event_KillTriger( params )
  948.  
  949.     self.fEngineHealth = 0;
  950.  
  951. end
  952.  
  953.  
  954. ----------------------------------------------------------------------------------------------------------------------------
  955. --
  956. --
  957. function Bigtrack:DropPeople()
  958.  
  959.     VC.DropPeople( self );
  960.  
  961. end
  962.  
  963. ----------------------------------------------------------------------------------------------------------------------------
  964. --
  965. function Bigtrack:Event_DriverIn( params )
  966.  
  967.     BroadcastEvent( self,"DriverIn" );
  968.     
  969. end    
  970.  
  971. -----------------------------------------------------------------------------------------------------
  972. --
  973. --
  974. function Bigtrack:Event_Activate( params )
  975.  
  976.     if(self.bExploded == 1) then return end
  977.     
  978.     self:GotoState( "Alive" );
  979. end
  980.  
  981. ----------------------------------------------------------------------------------------------------------------------------
  982. ----------------------------------------------------------------------------------------------------------------------------
  983. --
  984. --
  985. --------------------------------------------------------------------------------------------------------
  986. -- empty function to get reed of script error - it's called from behavours
  987. function Bigtrack:MakeAlerted()
  988. end
  989.  
  990.  
  991. --------------------------------------------------------------------------------------------------------------
  992.  
  993.